<?php
namespace app\web\controller;

use app\model\Theme; 

class LtDelLtItem extends Base
{
    public function Lt_delLtItem()
    {
/**
 * Created by 抽奖大转盘
 * Desc:后台删除奖项操作
 * User:cbw
 * Date: 2020/11/29
 */

global $_G,$_P;
//load_func('logging');
$response = modelShow(40000);
if (!$_G['ispost']){
    $response = modelShow(50000);
}else{
    $params = $_P;
    $ltt_id = isset($params['ltt_id'])?$params['ltt_id']:'';
    $themeid = isset($params['themeid'])?$params['themeid']:'';
    $theme = Theme::getThemeById($themeid);
    if (!$theme){
        $response = modelShow(40002);
        return_msg($response, '', 'ajax');
    }
    if (!$ltt_id ){
        $response = modelShow(40001);
    }else{
        try {
            $res = db_delete(t_lottery,['ltt_id'=>$ltt_id]);
            if (!$res){
                $response = modelShow(30000);
            }else{
                $response = modelShow(200);
            }
        }catch (Exception $e) {
            logging_run('错误日志:DelLtItem[参数：'.json_encode($params).'-错误信息:'.$e->getMessage());
            $response = modelShow(200,$e->getMessage(),[]);
        }
    }
}
return_msg($response, '', 'ajax');
}
}